package com.example.mybatis_book.enums;

public enum BookStatus {
    DELETE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;
    private Integer code;
    private String msg;
    BookStatus(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BookStatus getMsgBYCode(Integer code) {
        switch (code) {
            case 0:
                return DELETE;
            case 1:
                return NORMAL;
            case 2:
                return FORBIDDEN;
            default:
                return FORBIDDEN;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
